package com.tony.demo.mvp.presenter.impl;

import com.tony.demo.bean.UserInfo;
import com.tony.demo.mvp.model.LoginModel;
import com.tony.demo.mvp.presenter.interfaces.ILoginPresenter;
import com.tony.demo.mvp.views.ILoginView;
import com.tony.demo.test.eventbus.Subscribe;
import com.tony.demo.test.eventbus.ThreadMode;

/**
 * Copyright:
 * Created by TangJian on 2019/4/20.
 * Description:
 * Modified:
 */
public class LoginPresenter extends BasePresenter<ILoginView> implements ILoginPresenter {
    private LoginModel loginModel = new LoginModel();

    @Override
    public void startLogin(String userName, String password) {
        loginModel.getTiming(userName, password, mView.get().getActivity());
    }

    @Subscribe(threadMode = ThreadMode.POSTING, eventName = "onLoginResult")
    private void onLoginResult(UserInfo userInfo, Throwable t) {
        mView.get().stopLoading();

        if (null != t) {

        }
    }
}
